﻿using Outils.Comptabilite;
#if !NUNIT
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using NUnit.Framework;
using TestClass = NUnit.Framework.TestFixtureAttribute;
using TestMethod = NUnit.Framework.TestAttribute;
using TestInitialize = NUnit.Framework.SetUpAttribute;
using TestCleanup = NUnit.Framework.TearDownAttribute;
using ClassInitialize = NUnit.Framework.TestFixtureSetUpAttribute;
using ClassCleanup = NUnit.Framework.TestFixtureTearDownAttribute;
using TestContext = NUnit.Framework.Text;
#endif

namespace OutilsTests
{


    /// <summary>
    ///This is a test class for ComptabiliteTest and is intended
    ///to contain all ComptabiliteTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ComptabiliteTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        /// Test de la méthode SensEcriture
        ///</summary>
        [TestMethod()]
        public void SensEcritureTest()
        {
            bool blnCredit = true;
            string expected = "C";
            string actual;
            actual = Comptabilite.SensEcriture(blnCredit);
            Assert.AreEqual(expected, actual);

            blnCredit = false;
            expected = "D";
            actual = Comptabilite.SensEcriture(blnCredit);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        /// Test de la méthode SensEcriture
        ///</summary>
        [TestMethod()]
        public void SensEcritureParEnumTest()
        {
            SensComptable sens = SensComptable.Debit;
            string expected = "D";
            string actual;
            actual = Comptabilite.SensEcriture( sens );
            Assert.AreEqual( expected, actual, "" );

            sens = SensComptable.Credit;
            expected = "C"; 
            actual = Comptabilite.SensEcriture( sens );
            Assert.AreEqual( expected, actual, "" ); 
        }

        /// <summary>
        /// Test de la méthode SensEcritureChaine
        ///</summary>
        [TestMethod()]
        public void SensEcritureChaineTest()
        {
            SensComptable sens = SensComptable.Debit;
            string expected = "Débit";
            string actual;
            actual = Comptabilite.SensEcritureChaine( sens );
            Assert.AreEqual( expected, actual, "" );

            sens = SensComptable.Credit;
            expected = "Crédit";
            actual = Comptabilite.SensEcritureChaine( sens );
            Assert.AreEqual( expected, actual, "" ); 
        }
    }
}
